package com.sicheng.lc.周赛.分类.哈西表or计数or滑动窗口or双指针.滑动窗口;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/6/15 15:36
 */
public class 找到一个数字的K美丽值 {
    //https://leetcode.cn/problems/find-the-k-beauty-of-a-number/
    public int divisorSubstrings(int num, int k) {
        String s = String.valueOf(num);
        int count = 0;
        for (int i = 0; i < s.length() - k + 1; i++) {
            int x = 0;
            for (int j = 0; j < k; j++) {
                x = x * 10 + (s.charAt(i + j) - '0');
            }
            if (x != 0 && num % x == 0) {
                count++;
            }
        }
        return count;
    }
}
